﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QL_NOI_TRU
{
    public partial class frmCapNhatDSPhongPhauThuat : DevExpress.XtraEditors.XtraForm
    {
        public frmCapNhatDSPhongPhauThuat()
        {
            InitializeComponent();
        }

        private void frmCapNhatDSPhongPhauThuat_Load(object sender, EventArgs e)
        {
            //do du lieu vao grid
            var kn = new Ketnoi(frmDangnhap.stringConn);
            gridControl1.DataSource = kn.ExcuteQuery("select MAPHONGPT as 'Mã phòng phẫu thuật',TENPHONGPT as 'Tên phòng phẫu thuật' from PHONGPHAUTHUAT");

        }

        private void txtTenPhong_EditValueChanged(object sender, EventArgs e)
        {

        }

        private void labelControl2_Click(object sender, EventArgs e)
        {

        }

        private void labelControl1_Click(object sender, EventArgs e)
        {

        }

        private void txtmaPhong_EditValueChanged(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// xử lí khi nhấn nút lưu trên form cập nhật danh sách phòng Phẫu Thuật
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btLuu_Click(object sender, EventArgs e)
        {
            string strr = "EXEC Insert_PHONGPHAUTHUAT @MAPHONGPT = '" + txtmaPhongPT.Text.ToString().Trim() + "',@TENPHONGPT = N'" + txtTenPhongPT.Text.ToString().Trim() + "'";
            var kn = new Ketnoi(frmDangnhap.stringConn);
            kn.ExcuteQuery(strr);
            btRefresh_Click(null, null);
        }

        private void btXoa_Click(object sender, EventArgs e)
        {

        }

        private void btRefresh_Click(object sender, EventArgs e)
        {
            txtTenPhongPT.Text = "";
            txtmaPhongPT.Text = "";
            frmCapNhatDSPhongPhauThuat_Load(null, null);
        }
    }
}